#ifndef _CORELSPYAPI_H_
#define _CORELSPYAPI_H_

#include "StdAfx.h"
#include "../Detour/Inc/detours.h"
#include "CorelSpyMediator.h"
#include "CorelSpyAPIProxy.h"

HRESULT DetourAttach();
HRESULT DetourDetach();

extern VOID (WINAPI *TrueOutputDebugStringA)(LPCSTR lpOutputString);
VOID WINAPI CorelOutputDebugStringA(LPCSTR lpOutputString);

extern VOID (WINAPI *TrueOutputDebugStringW)(LPCWSTR lpOutputString);
VOID WINAPI CorelOutputDebugStringW(LPCWSTR lpOutputString);

extern LRESULT (WINAPI *TrueSendMessageA)(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
LRESULT WINAPI CorelSendMessageA(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);

extern LRESULT (WINAPI *TrueSendMessageW)(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
LRESULT WINAPI CorelSendMessageW(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);

extern BOOL (WINAPI *TruePostMessageA)(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
BOOL WINAPI CorelPostMessageA(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);

extern BOOL (WINAPI *TruePostMessageW)(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
BOOL WINAPI CorelPostMessageW(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);

extern long (WINAPI *TrueBroadcastSystemMessageA)(DWORD flags, LPDWORD lpInfo, UINT Msg, WPARAM wParam, LPARAM lParam);
long WINAPI CorelBroadcastSystemMessageA(DWORD flags, LPDWORD lpInfo, UINT Msg, WPARAM wParam, LPARAM lParam);

extern long (WINAPI *TrueBroadcastSystemMessageW)(DWORD flags, LPDWORD lpInfo, UINT Msg, WPARAM wParam, LPARAM lParam);
long WINAPI CorelBroadcastSystemMessageW(DWORD flags, LPDWORD lpInfo, UINT Msg, WPARAM wParam, LPARAM lParam);

extern long (WINAPI *TrueBroadcastSystemMessageExA)(DWORD flags,LPDWORD lpInfo, UINT Msg, WPARAM wParam, LPARAM lParam, PBSMINFO pbsmInfo);
long WINAPI CorelBroadcastSystemMessageExA(DWORD flags,LPDWORD lpInfo, UINT Msg, WPARAM wParam, LPARAM lParam, PBSMINFO pbsmInfo);

extern long (WINAPI *TrueBroadcastSystemMessageExW)(DWORD flags,LPDWORD lpInfo, UINT Msg, WPARAM wParam, LPARAM lParam, PBSMINFO pbsmInfo);
long WINAPI CorelBroadcastSystemMessageExW(DWORD flags,LPDWORD lpInfo, UINT Msg, WPARAM wParam, LPARAM lParam, PBSMINFO pbsmInfo);

extern HMODULE (WINAPI *TrueLoadLibraryA)(LPCSTR lpLibFileName);
HMODULE WINAPI CorelLoadLibraryA(LPCSTR lpLibFileName);

extern HMODULE (WINAPI *TrueLoadLibraryW)(LPCWSTR lpLibFileName);
HMODULE WINAPI CorelLoadLibraryW(LPCWSTR lpLibFileName);

extern HMODULE (WINAPI *TrueLoadLibraryExA)(LPCSTR lpLibFileName, HANDLE hFile, DWORD dwFlags);
HMODULE WINAPI CorelLoadLibraryExA(LPCSTR lpLibFileName, HANDLE hFile, DWORD dwFlags);

extern HMODULE (WINAPI *TrueLoadLibraryExW)(LPCWSTR lpLibFileName, HANDLE hFile, DWORD dwFlags);
HMODULE WINAPI CorelLoadLibraryExW(LPCWSTR lpLibFileName, HANDLE hFile, DWORD dwFlags);

extern int (WINAPI *TrueMultiByteToWideChar)(UINT CodePage, DWORD dwFlags, LPCSTR lpMultiByteStr, int cbMultiByte, LPWSTR lpWideCharStr, int cchWideChar);
int WINAPI CorelMultiByteToWideChar(UINT CodePage, DWORD dwFlags, LPCSTR lpMultiByteStr, int cbMultiByte, LPWSTR lpWideCharStr, int cchWideChar);

extern int (WINAPI *TrueWideCharToMultiByte)(UINT CodePage, DWORD dwFlags, LPCWSTR lpWideCharStr, int cchWideChar, LPSTR lpMultiByteStr, int cbMultiByte, LPCSTR lpDefaultChar, LPBOOL lpUsedDefaultChar);
int WINAPI CorelWideCharToMultiByte(UINT CodePage, DWORD dwFlags, LPCWSTR lpWideCharStr, int cchWideChar, LPSTR lpMultiByteStr, int cbMultiByte, LPCSTR lpDefaultChar, LPBOOL lpUsedDefaultChar);

typedef LONG (WINAPI *PFN_RtlMultiByteToUnicodeN)(PWCH UnicodeString, ULONG MaxBytesInUnicodeString, PULONG BytesInUnicodeString, const CHAR *MultiByteString, ULONG BytesInMultiByteString);
extern PFN_RtlMultiByteToUnicodeN TrueRtlMultiByteToUnicodeN;
LONG WINAPI CorelRtlMultiByteToUnicodeN(PWCH UnicodeString, ULONG MaxBytesInUnicodeString, PULONG BytesInUnicodeString, const CHAR *MultiByteString, ULONG BytesInMultiByteString);

typedef LONG (WINAPI *PFN_RtlUnicodeToMultiByteN)(PCHAR MultiByteString, ULONG MaxBytesInMultiByteString, PULONG BytesInMultiByteString, PCWCH UnicodeString, ULONG BytesInUnicodeString);
extern PFN_RtlUnicodeToMultiByteN TrueRtlUnicodeToMultiByteN;
LONG WINAPI CorelRtlUnicodeToMultiByteN(PCHAR MultiByteString, ULONG MaxBytesInMultiByteString, PULONG BytesInMultiByteString, PCWCH UnicodeString, ULONG BytesInUnicodeString);

typedef LONG (WINAPI *PFN_RtlMultiByteToUnicodeSize)(PULONG BytesInUnicodeString, const CHAR *MultiByteString, ULONG BytesInMultiByteString);
extern PFN_RtlMultiByteToUnicodeSize TrueRtlMultiByteToUnicodeSize;

typedef LONG (WINAPI *PFN_RtlUnicodeToMultiByteSize)(PULONG BytesInMultiByteString, PCWCH UnicodeString, ULONG BytesInUnicodeString);
extern PFN_RtlUnicodeToMultiByteSize TrueRtlUnicodeToMultiByteSize;

#endif // _CORELSPYAPI_H_